package com.linux.huhx.thread1;

import java.util.concurrent.TimeUnit;

public class DaemonThread extends Thread {
    DaemonThread(String name, boolean isDaemon) {
        setDaemon(isDaemon);
        setName(name);
    }

    @Override
    public void run() {
        try {
            TimeUnit.SECONDS.sleep(5);
            System.out.println(Thread.currentThread().getName() + " is daemon: " + Thread.currentThread().isDaemon());
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
